<?php
	
	
	$ini_array = parse_ini_file("config/config.ini");
		
	$conn = @mysqli_connect($ini_array["host"], $ini_array["username"], $ini_array["password"], $ini_array["db_name"]) or die("cann't connect the mysql db");
	//$conn = mysqli_connect($ini_array["host"], $ini_array["username"], $ini_array["password"], $ini_array["db_name"]);
	mysqli_set_charset($conn, "utf8");
	ini_set('default_charset', "UTF-8");
			
	$username=$_POST["username"];
	$username = mysqli_real_escape_string($conn, $username);
	$password=mysqli_real_escape_string($conn,$_POST["password"]);
	
	$sql="select count(*) count from user where Username='".$username."' and Password='".md5($password)."'";
	$result = @mysqli_query($conn, $sql);
	$data = "{\"data\":{";
	if( $row = mysqli_fetch_array($result) ){
		$count = $row["count"];
		if( $count == 0 ){
			$data .= "\"status\":\"fail\"}}";
		}else{
			$data .= "\"status\":\"success\"}}";
		}
	}
	//echo "qqq".md5($password)."qqq";	
	echo $data;
?>
